<html lang="zh-CN" class="ax-vertical-centered" xmlns:th="http://www.thymeleaf.org">
<head>
    <meta charset="UTF-8">
    <title>图书馆管理系统</title>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <link rel="stylesheet" th:href="@{/css/bootstrap.min.css}">
    <link rel="stylesheet" th:href="@{/css/bootstrap-theme.min.css}">
    <link rel="stylesheet" th:href="@{/css/bootstrap-admin-theme.css}">
    <link rel="stylesheet" th:href="@{/css/bootstrap-admin-theme.css}">
    <script th:src="@{/jQuery/jquery-3.1.1.min.js}"></script>
    <script th:src="@{/js/bootstrap.min.js}"></script>
    <script th:src="@{/js/bootstrap-dropdown.min.js}"></script>
    <script th:src="@{/js/addBook.js}"></script>
    <script th:src="@{/js/getBookInfo.js}"></script>
</head>


<script src="../js/jquery.min.js"></script>
<script src="../static/js/bootstrap.min.js"></script>


<body class="bootstrap-admin-with-small-navbar">
<nav class="navbar navbar-inverse navbar-fixed-top bootstrap-admin-navbar bootstrap-admin-navbar-under-small"
     role="navigation">
    <div class="container">
        <div class="row">
            <div class="col-lg-12">
                <div class="collapse navbar-collapse main-navbar-collapse">
                    <a class="navbar-brand" href="/manage/home"><strong>欢迎使用图书馆管理系统</strong></a>
                    <ul class="nav navbar-nav navbar-right">
                        <li class="dropdown">
                            <a href="#" role="button" class="dropdown-toggle" data-hover="dropdown">
                                <i class="glyphicon glyphicon-user"></i> 欢迎您，<span
                                    th:text="${session.admin.username}"></span>
                                <i class="caret"></i></a>

                            <ul class="dropdown-menu">
                                <li><a href="#updateinfo" data-toggle="modal">个人资料</a></li>
                                <li role="presentation" class="divider"></li>
                                <li><a href="#updatepwd" data-toggle="modal">修改密码</a></li>
                                <li role="presentation" class="divider"></li>
                                <li><a href="/admin/quit">退出</a></li>
                            </ul>

                        </li>
                    </ul>
                </div>
            </div>
        </div>
    </div>
</nav>
<input type="hidden" th:value="${msg}" id="msg"/>
<div class="container">
    <div class="row">
        <div class="col-md-2 bootstrap-admin-col-left">
            <ul class="nav navbar-collapse collapse bootstrap-admin-navbar-side">
                <li>
                    <a href="/manage/bookManage"><i
                            class="glyphicon glyphicon-chevron-right"></i> 图书管理</a>
                </li>
                <li>
                    <a href="/manage/bookTypeManage"><i
                            class="glyphicon glyphicon-chevron-right"></i> 图书分类管理</a>
                </li>


                <li>
                    <a href="/manage/borrowSearch"><i
                            class="glyphicon glyphicon-chevron-right"></i> 借阅查询</a>
                </li>


                <li>
                    <a href="/manage/adminManage"><i
                            class="glyphicon glyphicon-chevron-right"></i> 管理员管理</a>
                </li>

                <li>
                    <a href="/manage/readerManage"><i
                            class="glyphicon glyphicon-chevron-right"></i> 读者管理</a>
                </li>


            </ul>
        </div>

        <div class="col-md-10">


            <div class="row">
                <div class="col-lg-12">
                    <div class="panel panel-default bootstrap-admin-no-table-panel">
                        <div class="panel-heading">
                            <div class="text-muted bootstrap-admin-box-title">查询</div>
                        </div>
                        <div class="bootstrap-admin-no-table-panel-content bootstrap-admin-panel-content collapse in">
                            <form class="form-horizontal" action="/user/student_select"
                                  method="post">
                                <div class="col-lg-5 form-group">
                                    <label class="col-lg-4 control-label">用户账号</label>
                                    <div class="col-lg-8">
                                        <input class="form-control" id="bookId" name="id" type="text" value="">
                                        <label class="control-label" style="display: none;"></label>
                                    </div>
                                </div>

                                <div class="col-lg-5 form-group">
                                    <label class="col-lg-4 control-label">用户姓名</label>
                                    <div class="col-lg-8">
                                        <input class="form-control" id="bookId1" name="name" type="text" value="">
                                        <label class="control-label" style="display: none;"></label>
                                    </div>
                                </div>
                                <div class="col-lg-2 form-group">

                                    <button type="submit" class="btn btn-primary" id="btn_query">查询
                                    </button>
                                </div>
                                <div class="col-lg-2 form-group">

                                    <button type="button" class="btn btn-primary" id="btn_add" data-toggle="modal"
                                            data-target="#addModal">添加用户
                                    </button>
                                </div>
                            </form>
                        </div>
                    </div>
                </div>
            </div>


            <div class="row">
                <div class="col-lg-12">
                    <table id="data_list" class="table table-hover table-bordered" cellspacing="0" width="100%">
                        <thead>
                        <tr>
                            <th>用户账号</th>
                            <th>用户姓名</th>
                            <th>用户密码</th>
                            <th>用户类型</th>
                            <th>预约记录</th>
                            <th>操作</th>

                        </tr>
                        </thead>

                        <tbody th:if="${students != null}" th:each="s:${students}">
                        <td th:text="${s.id}"></td>
                        <td th:text="${s.name}"></td>
                        <td th:text="${s.pwd}"></td>
                        <td th:if="${s.at}==1" >
                            普通学生用户
                        </td>
                        <td th:if="${s.at}==2" >
                            班级干部用户
                        </td>
                        <td th:if="${s.count}==0" >
                            无
                        </td>
                        <td th:if="${s.count}!=0" >
                            <a>查看预约记录</a>
                        </td>
                        <td>

                            <button type="button" class="btn btn-warning btn-xs" data-toggle="modal"
                                    data-target="#updateModal">修改用户
                            </button>
                            <a>
                                <button type="button" class="btn btn-danger btn-xs">删除用户</button>
                            </a>
                        </td>
                        </tbody>
                    </table>
                </div>

            </div>
        </div>
    </div>
</div>



<!--------------------------------------查看的模糊框------------------------>
<form class="form-horizontal">
    <div class="modal fade" id="findModal" tabindex="-1" role="dialog" aria-labelledby="findModalLabel"
         aria-hidden="true">
        <div class="modal-dialog">
            <div class="modal-content">
                <div class="modal-header">
                    <button type="button" class="close" data-dismiss="modal" aria-hidden="true">
                        &times;
                    </button>
                    <h4 class="modal-title" id="findModalLabel">
                        查看图书信息
                    </h4>
                </div>
                <div class="modal-body">

                    <!---------------------表单-------------------->
                    <div class="form-group">
                        <label class="col-sm-3 control-label">ISBN号</label>
                        <div class="col-sm-7">
                            <input type="text" class="form-control" id="findISBN" readonly="readonly">

                        </div>
                    </div>
                    <div class="form-group">
                        <label class="col-sm-3 control-label">图书名称</label>
                        <div class="col-sm-7">
                            <input type="text" class="form-control" id="findBookName" readonly="readonly">

                        </div>
                    </div>

                    <div class="form-group">
                        <label class="col-sm-3 control-label">图书类型</label>
                        <div class="col-sm-7">
                            <input type="text" class="form-control" id="findBookType" readonly="readonly">

                        </div>
                    </div>

                    <div class="form-group">
                        <label class="col-sm-3 control-label">作者名称</label>
                        <div class="col-sm-7">
                            <input type="text" class="form-control" id="findAutho" readonly="readonly">

                        </div>
                    </div>


                    <div class="form-group">
                        <label class="col-sm-3 control-label">出版社</label>
                        <div class="col-sm-7">
                            <input type="text" class="form-control" id="findPress" readonly="readonly">

                        </div>
                    </div>


                    <div class="form-group">
                        <label class="col-sm-3 control-label">总数量</label>
                        <div class="col-sm-7">
                            <input type="text" class="form-control" id="findNum" readonly="readonly">

                        </div>
                    </div>

                    <div class="form-group">
                        <label class="col-sm-3 control-label">当前数量</label>
                        <div class="col-sm-7">
                            <input type="text" class="form-control" id="findCurrentNum" readonly="readonly">

                        </div>
                    </div>


                    <div class="form-group">
                        <label class="col-sm-3 control-label">价格</label>
                        <div class="col-sm-7">
                            <input type="text" class="form-control" id="findPrice" readonly="readonly">

                        </div>
                    </div>
                    <div class="form-group">
                        <label class="col-sm-3 control-label">操作管理员</label>
                        <div class="col-sm-7">
                            <input type="text" class="form-control" id="findAdmin" readonly="readonly">

                        </div>
                    </div>


                    <div class="form-group">
                        <label class="col-sm-3 control-label">简介</label>
                        <div class="col-sm-7">
                            <textarea class="form-control" rows="3" id="findDescription" readonly="readonly"></textarea>
                        </div>
                    </div>
                </div>
                <div class="modal-footer">
                    <button type="button" class="btn btn-default" data-dismiss="modal">关闭
                    </button>
                </div>
            </div>
        </div>
    </div>

</form>


<!--------------------------------------增加图书数量的模糊框------------------------>
<form class="form-horizontal">
    <div class="modal fade" id="addNumModal" tabindex="-1" role="dialog" aria-labelledby="addNumModalLabel"
         aria-hidden="true">
        <div class="modal-dialog">
            <div class="modal-content">
                <div class="modal-header">
                    <button type="button" class="close" data-dismiss="modal" aria-hidden="true">
                        &times;
                    </button>
                    <h4 class="modal-title" id="addNumModalLabel">
                        新增图书数量
                    </h4>
                </div>
                <div class="modal-body">

                    <div class="form-group">
                        <label class="col-sm-3 control-label">图书ISBN号</label>
                        <div class="col-sm-7">
                            <input type="hidden" id="addBookNumId">
                            <input type="text" class="form-control" id="addBookNumISBN" readonly="readonly">
                            <label class="control-label" for="addBookNumISBN" style="display: none;"></label>
                        </div>
                    </div>

                    <div class="form-group">
                        <label class="col-sm-3 control-label">新增数量</label>
                        <div class="col-sm-7">
                            <input type="text" class="form-control" id="addBookNum" placeholder="请输入新增的图书数量">
                            <label class="control-label" for="addBookNum" style="display: none;"></label>
                        </div>
                    </div>

                </div>
                <div class="modal-footer">
                    <button type="button" class="btn btn-default" data-dismiss="modal">关闭
                    </button>
                    <button type="button" class="btn btn-primary" id="add_BookNum">
                        新增
                    </button>
                </div>
            </div>
        </div>
    </div>

</form>



<!--------------------------------------添加的模糊框------------------------>
<form class="form-horizontal" action="/book/book_insert" id="book_insert">
    <div class="modal fade" id="addModal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
        <div class="modal-dialog">
            <div class="modal-content">
                <div class="modal-header">
                    <button type="button" class="close" data-dismiss="modal" aria-hidden="true">
                        &times;
                    </button>
                    <h4 class="modal-title" id="myModalLabel">
                        添加新图书
                    </h4>
                </div>
                <div class="modal-body">

                    <div class="form-group">
                        <label class="col-sm-3 control-label">图书ISBN号</label>
                        <div class="col-sm-7">
                            <input type="text" class="form-control" name="ISBN" id="addISBN" placeholder="请输入国际标准书号">
                            <label class="control-label" for="addISBN" style="display: none;"></label>
                        </div>
                    </div>

                    <div class="form-group">
                        <label class="col-sm-3 control-label">图书名称</label>
                        <div class="col-sm-7">
                            <input type="text" class="form-control" name="bookName" id="addBookName"
                                   placeholder="请输入图书名称">
                            <label class="control-label" for="addBookName" style="display: none;"></label>
                        </div>
                    </div>

                    <div class="form-group">
                        <label class="col-sm-3 control-label">图书类型</label>
                        <div class="col-sm-7">
                            <select class="form-control" name="bookType.typeId" id="addBookType">
                                <option th:each="bookType:${session.bookTypes}" th:value="${bookType.typeId}" th:text="${bookType.typeName}"></option>
                            </select>
                            <label class="control-label" for="addBookType" style="display: none;"></label>
                        </div>
                    </div>

                    <div class="form-group">
                        <label class="col-sm-3 control-label">作者名称</label>
                        <div class="col-sm-7">
                            <input type="text" class="form-control" name="autho" id="addAutho" placeholder="请输入作者名称">
                            <label class="control-label" for="addAutho" style="display: none;"></label>
                        </div>
                    </div>


                    <div class="form-group">
                        <label class="col-sm-3 control-label">出版社</label>
                        <div class="col-sm-7">
                            <input type="text" class="form-control" name="press" id="addPress" placeholder="请输入出版社">
                            <label class="control-label" for="addPress" style="display: none;"></label>
                        </div>
                    </div>


                    <div class="form-group">
                        <label class="col-sm-3 control-label">总数量</label>
                        <div class="col-sm-7">
                            <input type="text" class="form-control" name="num" id="addNum" placeholder="请输入图书总数量">
                            <label class="control-label" for="addNum" style="display: none;"></label>
                        </div>
                    </div>


                    <div class="form-group">
                        <label class="col-sm-3 control-label">价格</label>
                        <div class="col-sm-7">
                            <input type="text" class="form-control" name="price" id="addPrice" placeholder="请输入图书价格">
                            <label class="control-label" for="addPrice" style="display: none;"></label>
                        </div>
                    </div>


                    <div class="form-group">
                        <label class="col-sm-3 control-label">简介</label>
                        <div class="col-sm-7">
                            <textarea class="form-control" rows="3" name="description" id="addDescription"
                                      placeholder="请输入图书简介"></textarea>
                            <label class="control-label" for="addDescription" style="display: none;"></label>
                        </div>
                    </div>
                </div>
                <div class="modal-footer">
                    <button type="button" class="btn btn-default" data-dismiss="modal">关闭
                    </button>
                    <button type="button" class="btn btn-primary" id="addBook">
                        添加
                    </button>
                </div>
            </div><!-- /.modal-content -->
        </div><!-- /.modal -->
    </div>

</form>


<form class="form-horizontal" action="/book/book_update">
    <div class="modal fade" id="updateModal" tabindex="-1" role="dialog" aria-labelledby="updateModalLabel"
         aria-hidden="true">
        <div class="modal-dialog">
            <div class="modal-content">
                <div class="modal-header">
                    <button type="button" class="close" data-dismiss="modal" aria-hidden="true">
                        &times;
                    </button>
                    <h4 class="modal-title" id="updateModalLabel">
                        修改图书信息
                    </h4>
                </div>
                <div class="modal-body">
                    <input type="hidden" name="bookId" id="addbookId" value="">
                    <div class="form-group">
                        <label class="col-sm-3 control-label">图书ISBN号</label>
                        <div class="col-sm-7">
                            <input type="hidden" id="updateBookId">
                            <input type="text" class="form-control" name="ISBN" id="updateISBN" placeholder="请输入国际标准书号">
                            <label class="control-label" for="updateISBN" style="display: none;"></label>
                        </div>
                    </div>


                    <div class="form-group">
                        <label class="col-sm-3 control-label">图书名称</label>
                        <div class="col-sm-7">
                            <input type="text" class="form-control" id="updateBookName" name="bookName"
                                   placeholder="请输入图书名称">
                            <label class="control-label" for="updateBookName" style="display: none;"></label>
                        </div>
                    </div>

                    <div class="form-group">
                        <label class="col-sm-3 control-label">图书类型</label>
                        <div class="col-sm-7">
                            <select class="form-control" name="bookType.typeId" id="updateBookType">
                                <option th:each="bookType:${session.bookTypes}" th:value="${bookType.typeId}" th:text="${bookType.typeName}"></option>
                            </select>
                            <label class="control-label" for="updateBookType" style="display: none;"></label>
                        </div>
                    </div>

                    <div class="form-group">
                        <label class="col-sm-3 control-label">作者名称</label>
                        <div class="col-sm-7">
                            <input type="text" class="form-control" name="autho" id="updateAutho" placeholder="请输入作者名称">
                            <label class="control-label" for="updateAutho" style="display: none;"></label>
                        </div>
                    </div>


                    <div class="form-group">
                        <label class="col-sm-3 control-label">出版社</label>
                        <div class="col-sm-7">
                            <input type="text" class="form-control" name="press" id="updatePress" placeholder="请输入出版社">
                            <label class="control-label" for="updatePress" style="display: none;"></label>
                        </div>
                    </div>


                    <div class="form-group">
                        <label class="col-sm-3 control-label">价格</label>
                        <div class="col-sm-7">
                            <input type="text" class="form-control" name="price" id="updatePrice" placeholder="请输入图书价格">
                            <label class="control-label" for="updatePrice" style="display: none;"></label>
                        </div>
                    </div>


                    <div class="form-group">
                        <label class="col-sm-3 control-label">简介</label>
                        <div class="col-sm-7">
                            <textarea class="form-control" rows="3" name="description" id="updateDescription"
                                      placeholder="请输入图书简介"></textarea>
                            <label class="control-label" for="updateDescription" style="display: none;"></label>
                        </div>
                    </div>


                </div>
                <div class="modal-footer">
                    <button type="button" class="btn btn-default" data-dismiss="modal">关闭
                    </button>
                    <button type="submit" class="btn btn-primary" id="updateBook">
                        修改
                    </button>
                </div>
            </div>
        </div>
    </div>

</form>


<!------------------------------修改密码模糊框-------------------------------->

<form class="form-horizontal">

    <div class="modal fade" id="updatepwd" tabindex="-1" role="dialog" aria-labelledby="myModalLabel"
         aria-hidden="true">
        <div class="modal-dialog">
            <div class="modal-content">
                <div class="modal-header">
                    <button type="button" class="close" data-dismiss="modal" aria-hidden="true">
                        &times;
                    </button>
                    <h4 class="modal-title" id="myModalLabel">
                        修改密码
                    </h4>
                </div>

                <div class="modal-body">

                    <div class="form-group">
                        <label class="col-sm-3 control-label">原密码</label>
                        <div class="col-sm-7">
                            <input type="password" class="form-control" id="oldPwd" placeholder="请输入原密码">
                            <label class="control-label" for="oldPwd" style="display: none;"></label>
                        </div>
                    </div>

                    <div class="form-group">
                        <label class="col-sm-3 control-label">新密码</label>
                        <div class="col-sm-7">
                            <input type="password" class="form-control" id="newPwd" placeholder="请输入新密码">
                            <label class="control-label" for="newPwd" style="display: none;"></label>
                        </div>
                    </div>

                    <div class="form-group">
                        <label class="col-sm-3 control-label">确认密码</label>
                        <div class="col-sm-7">
                            <input type="password" class="form-control" id="confirmPwd" placeholder="请输入确认密码">
                            <label class="control-label" for="confirmPwd" style="display: none;"></label>
                        </div>
                    </div>


                </div>
                <div class="modal-footer">
                    <button type="button" class="btn btn-default" data-dismiss="modal">关闭
                    </button>
                    <button type="button" class="btn btn-primary" id="update_adminPwd">
                        修改
                    </button>
                </div>
            </div>
        </div>
    </div>

</form>


<!-------------------------个人资料模糊框------------------------------------->

<form class="form-horizontal">

    <div class="modal fade" id="updateinfo" tabindex="-1" role="dialog" aria-labelledby="ModalLabel" aria-hidden="true">
        <div class="modal-dialog">
            <div class="modal-content">
                <div class="modal-header">
                    <button type="button" class="close" data-dismiss="modal" aria-hidden="true">
                        &times;
                    </button>
                    <h4 class="modal-title" id="ModalLabel">
                        个人资料
                    </h4>
                </div>

                <div class="modal-body">


                    <div class="form-group">
                        <label class="col-sm-3 control-label">用户名</label>
                        <div class="col-sm-7">
                            <input type="text" class="form-control" id="username"
                                   th:value='${session.admin.username}'>
                            <label class="control-label" for="username" style="display: none;"></label>
                        </div>
                    </div>


                    <div class="form-group">
                        <label class="col-sm-3 control-label">真实姓名</label>
                        <div class="col-sm-7">
                            <input type="text" class="form-control" id="name" placeholder="请输入您的真实姓名"
                                   th:value="${session.admin.name}">
                            <label class="control-label" for="name" style="display: none;"></label>
                        </div>
                    </div>

                    <div class="form-group">
                        <label class="col-sm-3 control-label">联系号码</label>
                        <div class="col-sm-7">
                            <input type="text" class="form-control" id="phone" placeholder="请输入您的联系号码"
                                   th:value="${session.admin.phone}">
                            <label class="control-label" for="phone" style="display: none;"></label>

                        </div>
                    </div>




                </div>
                <div class="modal-footer">
                    <button type="button" class="btn btn-default" data-dismiss="modal">关闭
                    </button>
                    <button type="button" class="btn btn-primary" id="admin_updateInfo">
                        修改
                    </button>
                </div>
            </div>
        </div>
    </div>

</form>
<!-------------------------------------------------------------->


<div class="modal fade" id="modal_info" tabindex="-1" role="dialog" aria-labelledby="addModalLabel">
    <div class="modal-dialog" role="document">
        <div class="modal-content">
            <div class="modal-header">
                <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span>
                </button>
                <h4 class="modal-title" id="infoModalLabel">提示</h4>
            </div>
            <div class="modal-body">
                <div class="row">
                    <div class="col-lg-12" id="div_info"></div>
                </div>
            </div>
            <div class="modal-footer">
                <button type="button" class="btn btn-default" id="btn_info_close" data-dismiss="modal">关闭</button>
            </div>
        </div>
    </div>
</div>

</body>
</html>
